#include <cstdio>

struct Book {
  Book(const char *name_in, int pages_in) : name(name_in), pages(pages_in) {}
  // 即使 const 的 year 已经在定义时赋值过了, 但是在初始化列表中还可以重新赋值
  Book(const char *name_in, int year_in, int pages_in)
      : name(name_in), year{year_in}, pages(pages_in) {}

  const char *name;
  const int year = 2019;
  int pages;
};

int main(int argc, char **argv) {
  Book book1{"Good", 2020, 100};
  printf("The Book is %s, year is %d, has %d pages.\n", book1.name, book1.year,
         book1.pages);
  Book book2{"Red Book", 100};
  printf("The Book is %s, year is %d, has %d pages.\n", book2.name, book2.year,
         book2.pages);

  return 0;
}
